package avicit.bdp.dms.prm.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import avicit.platform6.core.properties.PlatformConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.multipart.MultipartFile;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * 数据元表实体
 */
@ApiModel(value = "DataElementDTO", description = "数据元实体类")
@Table(name = "bdp_prm_data_element")
public class DataElementDTO extends BaseDTO {

    /**
     * 主键ID
     */
    @LogField
    @ApiModelProperty(value = "主键ID")
    @FieldRemark(column = "id", field = "id", name = "主键")
    @Column(name = "id")
    @Id
    @javax.persistence.Id
    private String id;

    /**
     * 名称
     */
    @LogField
    @ApiModelProperty(value = "名称")
    @FieldRemark(column = "name", field = "name", name = "名称")
    @Column(name = "name")
    private String name;

    /**
     * 编码
     */
    @LogField
    @ApiModelProperty(value = "编码")
    @FieldRemark(column = "code", field = "code", name = "编码")
    @Column(name = "code")
    private String code;

    /**
     * 中文名
     */
    @LogField
    @ApiModelProperty(value = "中文名")
    @FieldRemark(column = "cnName", field = "cnName", name = "中文名")
    @Column(name = "cn_name")
    private String cnName;

    /**
     * 分类ID
     */
    @LogField
    @ApiModelProperty(value = "分类ID")
    @FieldRemark(column = "typeId", field = "typeId", name = "分类ID")
    @Column(name = "type_id")
    private String typeId;

    /**
     * 数据类型
     */
    @LogField
    @ApiModelProperty(value = "数据类型")
    @FieldRemark(column = "type", field = "type", name = "数据类型")
    @Column(name = "type")
    private String type;

    /**
     * 数据长度
     */
    @LogField
    @ApiModelProperty(value = "数据长度")
    @FieldRemark(column = "length", field = "length", name = "数据长度")
    @Column(name = "length")
    private Integer length;

    /**
     * 状态 0-停用 1-启用
     */
    @LogField
    @ApiModelProperty(value = "状态 0-停用 1-启用")
    @FieldRemark(column = "status", field = "status", name = "状态 0-停用 1-启用")
    @Column(name = "status")
    private Integer status;

    /**
     * 是否引用码表 0-否 1-是
     */
    @LogField
    @ApiModelProperty(value = "是否引用码表 0-否 1-是")
    @FieldRemark(column = "codetable", field = "codetable", name = "是否引用码表 0-否 1-是")
    @Column(name = "codetable")
    private Integer codetable;

    /**
     * 引用码表ID
     */
    @LogField
    @ApiModelProperty(value = "引用码表ID")
    @FieldRemark(column = "codeTableid", field = "codeTableid", name = "引用码表ID")
    @Column(name = "code_tableid")
    private String codeTableid;

    /**
     * 引用码表字段
     */
    @LogField
    @ApiModelProperty(value = "引用码表字段")
    @FieldRemark(column = "codeColumnid", field = "codeColumnid", name = "引用码表字段")
    @Column(name = "code_columnid")
    private String codeColumnid;

    /**
     * 备注
     */
    @LogField
    @ApiModelProperty(value = "备注")
    @FieldRemark(column = "remark", field = "remark", name = "备注")
    @Column(name = "remark")
    private String remark;

    @Transient
    private String createUser;

    @Transient
    private MultipartFile file;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getCnName() {
        return cnName;
    }

    public void setCnName(String cnName) {
        this.cnName = cnName;
    }

    public String getTypeId() {
        return typeId;
    }

    public void setTypeId(String typeId) {
        this.typeId = typeId;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Integer getLength() {
        return length;
    }

    public void setLength(Integer length) {
        this.length = length;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getCodetable() {
        return codetable;
    }

    public void setCodetable(Integer codetable) {
        this.codetable = codetable;
    }

    public String getCodeTableid() {
        return codeTableid;
    }

    public void setCodeTableid(String codeTableid) {
        this.codeTableid = codeTableid;
    }

    public String getCodeColumnid() {
        return codeColumnid;
    }

    public void setCodeColumnid(String codeColumnid) {
        this.codeColumnid = codeColumnid;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public MultipartFile getFile() {
        return file;
    }

    public void setFile(MultipartFile file) {
        this.file = file;
    }

    @Override
    public String getLogFormName() {
        if (StringUtils.isEmpty(super.logFormName)) {
            return "数据元管理";
        } else {
            return super.logFormName;
        }
    }

    @Override
    public String getLogTitle() {
        if (StringUtils.isEmpty(super.logTitle)) {
            return "数据元";
        } else {
            return super.logTitle;
        }
    }

    @Override
    public PlatformConstant.LogType getLogType() {
        if (super.logType == null) {
            return PlatformConstant.LogType.module_operate;
        } else {
            return super.logType;
        }
    }

}
